#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    int T; cin >> T;
    while(T--){
        int in; cin >> in;
        int more = 0, ans = 0;
        while(in > 9){
            more = in/10;
            ans += more * 10;
            in %= 10;
            in += more;
        }
        ans += in;
        cout << ans << '\n';
    }
    return 0;
}